package com.hksj.am.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.hksj.am.query.AlarmDetailQuery;
import com.hksj.am.service.AmmoniaAlarmService;
import com.hksj.am.vo.AlarmDeviceInfoVO;
import com.hksj.common.core.model.Rest;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletResponse;

/**
 * @author fjt
 * @data 2024/11/6 18:20
 * @describe
 */
@Api(tags = "氨气监测——报警列表")
@RestController
@RequestMapping("/api/am/alarm")
public class AmmoniaAlarmController {


    @Autowired
    private AmmoniaAlarmService ammoniaAlarmService;


    @PostMapping("/page")
    @ApiOperation(value = "分页查询报警列表", notes = "分页查询报警列表",response = AlarmDeviceInfoVO.class)
    public Rest<Page<AlarmDeviceInfoVO>> pageAlarm(@RequestBody AlarmDetailQuery query){
        return Rest.ok(ammoniaAlarmService.pageAlarm(query));
    }


    @PostMapping("/exportList")
    @ApiOperation(value = "导出报警记录", notes = "导出报警记录")
    public void exportList(HttpServletResponse response, @RequestBody AlarmDetailQuery query){
       ammoniaAlarmService.exportList(response, query);
    }

}
